package model;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * 每个 model.Blog 对象对应 model.Blog 表中的一条记录
 */
@SuppressWarnings({"all"})
public class Blog {

    private int blogId;
    private String title;
    private String content;
    private int userId;
    private Timestamp postTime;

    public int getBlogId() {
        return blogId;
    }

    public void setBlogId(int blogId) {
        this.blogId = blogId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

//    public Timestamp getPostTime() {
//        return postTime;
//    }

    public String getPostTime(){
        // 这里对原先的 getPostTime() 进行修改, 将时间戳转化成格式化字符串并返回
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(postTime);
    }

    public void setPostTime(Timestamp postTime) {
        this.postTime = postTime;
    }
}
